<?php


namespace App\Services\Agora;


class ChannelService extends BaseService
{
    /**
     * 该方法查询某个用户是否在指定频道中，以及该用户在该频道中的角色等状态
     * @param $uid
     * @param $channelName
     * @return bool|mixed|string
     */
    public function userProperty($uid, $channelName)
    {
        $uri = "/dev/v1/channel/user/property/{$this->appid}/{$uid}/{$channelName}";
        $res = $this->request($uri, [], 'GET');
        return $res;
    }

    /**
     * 获取用户列表
     * @param $channelName
     * @return bool|mixed|string
     */
    public function userList($channelName)
    {
        $uri = "/dev/v1/channel/user/{$this->appid}/{$channelName}";
        $res = $this->request($uri, [], 'GET');
        return $res;
    }

    /**
     * 分页查询项目的频道列表
     * @param int $page_no
     * @param int $page_size
     * @return bool|mixed|string
     */
    public function channelList($page_no = 0, $page_size = 100)
    {
        $uri = "/dev/v1/channel/{$this->appid}";
        $res = $this->request($uri, [
            'page_no' => $page_no,
            'page_size' => $page_size
        ], 'GET');
        return $res;
    }
}
